class_name ExtensionMethod_Common
extends ExtensionMethod

#region 属性
#endregion
#region 字段
#endregion
#region 信号
#endregion

#region 基类方法
func init(ex):
	super.init(ex)
func on_equip():
	super.on_equip()
func on_unequip():
	super.on_unequip()
func set_enable(enable:bool):
	super.set_enable(enable)
#endregion
#region 公共方法
func check_capacity(anim_name:String,check_time:float):
	if check_time < 0:
		var state_manager = weaponC_extension_method.weapon.get_component_by_name("WeaponC_StateManager") as WeaponC_StateManager
		state_manager.add_anim_finished_event(anim_name,func (_anim_name:String):
			if _anim_name == anim_name:
				_check_capacity()
			,CONNECT_ONE_SHOT)
	else:
		_check_capacity()
func set_anim_speed_scale(anim_name:String,scale:float):
	var state_manager = weaponC_extension_method.weapon.get_component_by_name("WeaponC_StateManager") as WeaponC_StateManager
	_set_anim_speed_scale(scale)
	state_manager.add_anim_finished_event(anim_name,func (_anim_name:String):
		if _anim_name == anim_name:
			_set_anim_speed_scale(1/scale)
		,CONNECT_ONE_SHOT)
#endregion
#region 私有方法
func _check_capacity():
	var c_capacity = weaponC_extension_method.weapon.get_component_by_name("WeaponC_Capacity")
	if c_capacity:
		# 动画结束主动检查容量是否需要Reload
		c_capacity.get_from_capacity(0)
func _set_anim_speed_scale(scale:float):
	var state_manager = weaponC_extension_method.weapon.get_component_by_name("WeaponC_StateManager") as WeaponC_StateManager
	state_manager.set_animation_speed_scale(scale)
#endregion
#region 生命周期函数
#endregion

